<template>
  <div>
    <div id="head">
      <van-icon size="25px" @click="toHead()" name="arrow-left"
                style="position: absolute;left: 10px;" />
      我的申请
    </div>
    <div class="ticket-list">
      <div v-for="one in applyForList" :key="one.id" class="ticket-item">
        <div class="ticket-content">
          <div class="ticket-info">
            <div class="ticket-header">申请单号：{{ one.applyCode }}</div>
            <div class="ticket-header">申请类型：{{ one.applyType }}</div>
            <div class="ticket-code">申请时间：{{ one.applyTime }}</div>
          </div>
          <div class="ticket-actions">
            <van-button type="primary" size="small" @click="toDetails(one)"><b>详情</b></van-button>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import axios, {Axios} from "axios";

export default {
  data(){
    return{
      applyForList:[]
    }
  },
  methods:{
    findAll(){
      axios.post("http://localhost:9999/myModule-service/applyForHome/findAll").then(res=>{
        this.applyForList = res.data;
      })
    },
    toDetails(one){
      this.$router.push({
        path:'/homeDetails',
        query:{
          id:one.id
        }
      })
    },
    toHead(){
      this.$router.push('/my')
    }
  },
  created(){
    this.findAll();
  }
}
</script>

<style scoped>
#head{
  background-color: #f5f5f5;
  height: 30px;
  width: 100%;
  padding-top: 10px;
  padding-bottom: 10px;
  text-align: center;
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 10px;
}
.ticket-view {
  min-height: 100vh;
  background-color: #f7f8fa;
  padding-top: 46px;
}

.filter-container {
  position: sticky;
  top: 46px;
  z-index: 10;
}

:deep(.van-dropdown-menu) {
  background-color: #fff;
}

.ticket-list {
  padding: 12px;
}

.ticket-item {
  background-color: #fff;
  border-radius: 8px;
  border: #ebedf0 1px solid;
  padding: 12px;
  margin-bottom: 12px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.ticket-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding-bottom: 8px;
  color: #323233;
  border-bottom: 1px solid #ebedf0;
}

.ticket-id {
  font-size: 14px;
  color: red;
}
.ticket-code{
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #323233;
}

.ticket-priority {
  font-size: 14px;
  font-weight: 500;
}

.ticket-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ticket-info {
  font-size: 13px;
  color: #646566;
  line-height: 1.5;
}

:deep(.van-button--primary) {
  background-color: #1989fa;
  border-color: #1989fa;
  color: white;
}

:deep(.van-button--success) {
  background-color: #07c160;
  border-color: #07c160;
  color: white;
}
</style>
